<template>
  <el-card style="margin: 100px auto; background-color: #fff; width: 550px; height: 430px; padding: 20px; border-radius: 10px">
    <el-form label-width="80px" size="small">


      <el-form-item label="社团名字">
        <el-input v-model="form.campusName" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="社团规模（人）">
        <el-input v-model="form.campusScale" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="社团简介">
        <el-input v-model="form.campusInfo" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">确 定</el-button>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script>
import {serverIp} from "../../../public/config";

export default {
  name: "Person",
  data() {
    return {
      serverIp: serverIp,
      form: {},
      user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {}
    }
  },
  created() {
    this.getCampus().then(res => {
      this.form = res
      console.log("ttttttttttttt"+this.form.masterId)
      this.form.campusId = res.id
    })
  },
  methods: {
    async getCampus() {
      return (await this.request.get("/campus/mycampus?uid=" + this.user.id)).data
    },
    save() {
      this.request.post("/campus/updatecampus", this.form).then(res => {
        if (res.code === '200') {
          this.$message.success("保存成功")
        } else {
          this.$message.error("保存失败")
        }
      })
    }
  }
}
</script>

<style>
.avatar-uploader {
  text-align: center;
  padding-bottom: 10px;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 138px;
  height: 138px;
  line-height: 138px;
  text-align: center;
}
.avatar {
  width: 138px;
  height: 138px;
  display: block;
}
</style>
